package com.wwwarehouse.taskcenter.fragment.warehouse_handover;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.wwwarehouse.common.activity.base.BaseFragment;
import com.wwwarehouse.common.bean.response.CardDeskTaskResponseBean;
import com.wwwarehouse.common.constant.Constant;
import com.wwwarehouse.common.custom_widget.button.StateButton;
import com.wwwarehouse.taskcenter.R;

/**
 * @创建者 chenchao.
 * @创建时间 2017/11/27 11:39
 * @描述 ${TODO}
 */

public class EnterWprkCodeFragment extends BaseFragment implements View.OnClickListener {

    private View mView;
    private RelativeLayout mRlNotConnected;
    private StateButton mBtNotConnected;
    private RelativeLayout mRlConnected;
    private StateButton mBtConnected;
    private String                       mBelongBusiness;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mView = inflater.inflate(R.layout.fragment_enter_work_code, container, false);
        initView();
        return mView;
    }

    @Override
    public void requestDatas() {
        //获取
        if (getArguments() != null) {
            Bundle bundle = getArguments();
            CardDeskTaskResponseBean.TaskBean taskBean = (CardDeskTaskResponseBean.TaskBean) bundle.getSerializable(Constant.KEY_CARD_DESK_TASK_DETAILS);//KEY_CARD_DESK_FUNCTION_DETAILS
            mBelongBusiness = taskBean.getBelongBusiness();
        }
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.bt_not_connected) {//点击连接指环
            pushFragment(new ScanTemporaryAreaFragment());
        } else if (id == R.id.bt_connected) {//点击更换指环

        }
    }

    private void initView() {

        mRlNotConnected = findView(mView, R.id.rl_not_connected);
        mBtNotConnected = findView(mView, R.id.bt_not_connected);
        mRlConnected = findView(mView, R.id.rl_connected);
        mBtConnected = findView(mView, R.id.bt_connected);

        mBtNotConnected.setOnClickListener(this);
        mBtConnected.setOnClickListener(this);
    }

    @Override
    public void setTitle() {
        if (peekFragment() instanceof EnterWprkCodeFragment) {
            mActivity.setTitle(R.string.task_enter_work_code);
        }
    }

}
